package com.ubb.damate.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/** The primary key class for the user_event database table. */
@Embeddable
public class UserEventPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long	serialVersionUID	= 1L;

	@Column(name = "Username", unique = false, nullable = false, length = 20)
	private String				username;

	@Column(name = "Eventname", unique = false, nullable = false, length = 20)
	private String				eventname;

	@Temporal(TemporalType.DATE)
	@Column(name = "Eventdate", nullable = false)
	private Date				eventdate;

	public UserEventPK() {
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getEventname() {
		return this.eventname;
	}

	public void setEventname(String eventname) {
		this.eventname = eventname;
	}

	public Date getEventdate() {
		return this.eventdate;
	}

	public void setEventdate(Date eventdate) {
		this.eventdate = eventdate;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof UserEventPK)) {
			return false;
		}
		UserEventPK castOther = (UserEventPK) other;
		return this.username.equals(castOther.username) && this.eventname.equals(castOther.eventname) && this.eventdate.equals(castOther.eventdate);

	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.username.hashCode();
		hash = hash * prime + this.eventname.hashCode();
		hash = hash * prime + this.eventdate.hashCode();

		return hash;
	}
}